﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace Lottery.Client.SL
{
    public class ConvertPriceToBrush:IValueConverter
    {
        private static Brush _brush1;
        private static Brush _brush2;
        private static Brush _brush3;
        static ConvertPriceToBrush()
        {
            ConvertPriceToBrush._brush1 = new SolidColorBrush(Colors.Red);
            ConvertPriceToBrush._brush2 = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
            ConvertPriceToBrush._brush3 = new SolidColorBrush(Colors.White);
        }
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double num = System.Convert.ToDouble(value);
            if (num > 0.0)
            {
                return ConvertPriceToBrush._brush1;
            }
            if (num < 0.0)
            {
                return ConvertPriceToBrush._brush2;
            }
            return ConvertPriceToBrush._brush3;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
